home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-05-04 | 938 b | 50 lines | [TEXT/MPS ] |
- /*
- File: TrapAvailable.cp
-
- Contains: xxx put contents here xxx
-
- Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #ifndef __TRAPS__
- #include <Traps.h>
- #endif
-
- /**********************************************************************
- ** TrapAvailable
- ***********************************************************************/
-
- short NumToolboxTraps()
- {
- if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E, ToolTrap))
- return 0x200;
- else
- return 0x400;
- }
-
-
- TrapType GetTrapType(short theTrap)
- {
- const TrapMask = 0x800;
-
- if ((theTrap & TrapMask) > 0)
- return ToolTrap;
- else
- return OSTrap;
- }
-
- Boolean TrapAvailable(short theTrap)
- {
- TrapType tType;
-
- tType = GetTrapType(theTrap);
- if (tType == ToolTrap) {
- theTrap = (theTrap & 0x07ff);
- if (theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
- }
-
- return NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap);
- }
-